The present invention relates to a memory subsystem including a mass memory (disks) and a cache store for storing segments of data, and more particularly to a method and apparatus where different ages are assigned to segments of data depending on whether the segments are brought into the cache store because they were accessed by a host processor, or are brought into the cache store on speculation that they contain data which may be soon accessed by the host processor.
Swenson U.S. Pat. No. 4,394,733 discloses a cache/disk subsystem wherein a host processor issues a command to a storage control unit in order to read one or more data words from, or write one or more data words to a disk memory. Data is formatted on the disks by segments and a cache store is provided for storing copies of segments of data which have been recently accessed by the processor, or are likely to be soon accessed by the processor. When the processor issues a command, the storage control unit checks to see if the segment or segments containing the desired data word or words is/are present in the cache store and, if so, a data transfer takes place between the cache store and the processor. If the segment is modified, i.e. a write command is executed, then the modified segment is copied back to a disk at some later time as described in U.S. Pat. No. 4,394,732.
If a copy of the data word or words specified by a processor command are not resident in the cache store then the storage control unit transfers the segment or segments of data containing these words from a disk to the cache store and the processor (for a read command) or transfers the segments to the storage control unit where they are modified by the data from the processor (a write command) before being written into the cache store.
A segment descriptor table is maintained which contains an entry corresponding to each segment of data in the cache store. Each segment descriptor contains information relating to its segment and each entry includes a forward and a backward age link. The age links comprise an age chain which links the segments from most recently used to least recently used. Each time a data segment is accessed in the cache store, its corresponding entry in the table is modified to make it the most recently used in the age chain. In like manner, when a segment of data is moved from a disk to the cache store because a command has specified access to a word or words in the segment, the segment descriptor table entry for that segment is modified to make it the most recently used in the age chain. When copying segments of data from the cache store to the disks, the least recently used segments are transferred first so that the most recently used segments remain resident in the cache store.
The system as described above exploits the hypothesis generally referred to as history of reference. This hypothesis states that if reference is made to location X, the probability of location X being referenced again is higher than the probability of location Y being referenced, where Y is a random location.
A further hypothesis, generally referred to as linearity of reference, holds that if reference is made to location X, the probability of location X+1 being referenced is higher than the probability of location Y being referenced, where Y is a random location. The prior art and U.S. Pat. No. 4,394,733 both operate in conformance with these hypotheses.
The present invention provides a method and means for optimizing both referencing patterns. When a command seeks to access data words from a segment not resident in the cache store, the segment containing the accessed data words is transferred to the cache store together with one or more additional or speculative segments. The speculative segments are so named because, in accordance with the linearity of reference hypothesis it is speculated or assumed that they will likely soon be accessed by a command. The segment containing the accessed data words is assigned a most recently used age in the age chain while the additional or speculative segments are assigned an age which is intermediate the most recently used age and the least recently used age. Therefore, if a particular reference pattern (i.e. sequence of processor commands) exhibits a linear characteristic then the additional segments are available in the cache store at the older age. If the reference pattern exhibits an historical characteristic then the additional segments will move toward the bottom of the age list (LRU) and will become available for replacement sooner than the referenced segments.